Field of the Invention
The present invention relates to information handling systems. More specifically, embodiments of the invention relate to operations to shrink datafiles.
Description of the Related Art
As the value and use of information continues to increase, individuals and businesses seek additional ways to process and store information. One option available to users is information handling systems. An information handling system generally processes, compiles, stores, and/or communicates information or data for business, personal, or other purposes thereby allowing users to take advantage of the value of the information. Because technology and information handling needs and requirements vary between different users or applications, information handling systems may also vary regarding what information is handled, how the information is handled, how much information is processed, stored, or communicated, and how quickly and efficiently the information may be processed, stored, or communicated. The variations in information handling systems allow for information handling systems to be general or configured for a specific user or specific use such as financial transaction processing, airline reservations, enterprise data storage, or global communications. In addition, information handling systems may include a variety of hardware and software components that may be configured to process, store, and communicate information and may include one or more computer systems, data storage systems, and networking systems.
It is known to provide information handling systems with operating systems. It is also known to provide an operating system with a datafile file structure that is used by a software application. These file structures may contain unused areas that can consume unnecessary space. Over time, a datafile can contain unused areas mixed in with used areas. FIG. 1A, labeled Prior Art, shows a block diagram of an example of a datafile. The datafile includes a datafile header portion 110, datafile used area portions 120, datafile unused (but previously used) area portions 130 and a datafile formatted (but never used portion) 140
One type of application which uses datafiles is a database application. In a database application, logical data structures (named datafiles), such as tables and indexes, are stored in physical files on disk. Datafiles can contain areas that are currently used, areas previously used and currently unused and areas that were never used. The never used area of a datafile is usually found at the end of the datafile. The database application will often use space starting from the beginning of the file and moving towards the end. Inside these datafiles, the logical data structures (tables, indexes, LOBs, etc.) are stored in data blocks. Contiguous data blocks (i.e., segments) associated to the same data structure form an extent. All extents allocated for a database object form what is called the segment. Each segment can contain multiple extents that are spread out in non-contiguous areas of one or more datafiles.
It is known to resize a datafile to allocate more space to it, or to reduce the amount of space the file can take on disk. Increasing the size of a datafile requires more disk space at the operating system level but is a relatively simple operation. Most database applications allow reducing the size of a datafile as long as the reducing operation does not attempt to remove areas that are currently used. To do this, knowledge of the physical location of the last used area in the datafile is needed. When the location of the last used extent is identified, (e.g., via line 150) the datafile can be resized to that point. FIG. 1B, labeled Prior Art, shows a block diagram of an example of the result of such a size reduction operation.